package ru.urfc.portal.ui.client;

import java.util.Date;

import junit.framework.TestCase;

import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.DateTimeFormat;

@SuppressStaticInitializationFor("ru.urfc.portal.ui.client.BaseGooglet")
@RunWith(PowerMockRunner.class)
@PrepareForTest({GWT.class, DateTimeFormat.class, Element.class, AnchorElement.class})
public class MockedGwtTestCase extends TestCase {

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		PowerMockito.suppress(PowerMockito.method(GWT.class, "create", Class.class));
		PowerMockito.suppress(PowerMockito.method(DateTimeFormat.class, "format", Date.class));
		
		App.initEnums();
		Element element = Mockito.mock(Element.class);
		PowerMockito.suppress(PowerMockito.method(Element.class, "setInnerText", String.class));
		PowerMockito.stub(PowerMockito.method(Element.class, "getParentElement")).andReturn(element);
		PowerMockito.stub(PowerMockito.method(Element.class, "getInnerHTML")).andReturn("");
		PowerMockito.suppress(PowerMockito.method(AnchorElement.class, "setHref", String.class));		
	}
	
}
